package com.realbrand.net.realbrandpay;

import android.app.Application;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.CountDownTimer;
import android.view.KeyEvent;
import android.widget.Toast;


import com.realbrand.net.realbrandpay.untils.Constant;
import com.realbrand.net.realbrandpay.zxing.util.L;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;

import java.util.List;
import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;

/**
 * Created by Administrator on 2017/5/26.
 */

public class APP extends Application {
    public final static int CONNECT_TIMEOUT = 60;
    public final static int READ_TIMEOUT = 100;
    public final static int WRITE_TIMEOUT = 60;
    public static final OkHttpClient client = new OkHttpClient.Builder()
            .readTimeout(READ_TIMEOUT, TimeUnit.SECONDS)
            .writeTimeout(WRITE_TIMEOUT, TimeUnit.SECONDS)
            .connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS)
            .build();

    public static boolean supportWX = false;
    public static boolean supportAlipay = false;
    //用户微信是否已授权
    public static boolean WXIsAuth = false;
    //用户支付宝是否已授权
    public static boolean AlipayIsAuth = false;

    @Override
    public void onCreate() {
        super.onCreate();
        Constant.wx_api = WXAPIFactory.createWXAPI(this, Constant.WXAPP_ID, true);
        Constant.wx_api.registerApp(Constant.WXAPP_ID);
        SharedPreferences sharedPreferences = getSharedPreferences(Constant.shareName, MODE_PRIVATE);
        String alipayName = sharedPreferences.getString("alipayName", "");
        String wxName = sharedPreferences.getString("WXName", "");
        if (!"".equals(alipayName)) {
            AlipayIsAuth = true;
        } else {
            AlipayIsAuth = false;
        }
        if (!"".equals(wxName)) {
            WXIsAuth = true;
        } else {
            WXIsAuth = false;
        }

    }

    public  List<String> list;

    public List<String> getList() {
        return list;
    }

    public void setList(List<String> list) {
        this.list = list;
    }
}
